home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Games / Starter / JST / Developer / sources / jst / gp_macros.i next >
Encoding:
Text File  |  1999-12-03  |  16.2 KB  |  607 lines

  1.     IFND    GP_MACROS_I_INCLUDED
  2. GP_MACROS_I_INCLUDED    =    1
  3.  
  4.     include    "osemu.i"
  5.  
  6.     MC68000
  7.  
  8. ; ** currently used disk sizes
  9.  
  10. STD_DISK_SIZE = 901120    ; standard dos copiable disks
  11. B12_DISK_SIZE = 970752    ; 12 sectored 79 tracks disks, dos bootblock
  12. S12_DISK_SIZE = 983040    ; 12 sectored 79 tracks disks, dos bootblock
  13.  
  14. ; ** Tooltype/argument definitions
  15.  
  16. ; bits
  17.  
  18. AFB_NTSC = 0
  19. AFB_LOWMEM = 1
  20. AFB_HDLOAD = 2
  21. AFB_TRAINER = 3
  22. AFB_NOOSSWAP = 4
  23. AFB_JOYPAD = 5
  24.  
  25. ; ** joypad button definitions (for JoyButtonsState)
  26.  
  27. ; ** masks
  28.  
  29. AFF_FIRE1 = $20        ; red joypad button
  30. AFF_START = $01        ; start/pause joypad button
  31. AFF_FIRE2 = $40        ; blue joypad button
  32. AFF_FIRE4 = $08        ; green joypad button
  33. AFF_FIRE3 = $10        ; yellow joypad button
  34. AFF_FORWD = $04        ; forward joypad key
  35. AFF_BACWD = $02        ; back joypad key
  36.  
  37. ; ** bits
  38.  
  39. AFB_START = $0        ; start/pause joypad button
  40. AFB_BACWD = $1        ; back joypad key
  41. AFB_FORWD = $2        ; forward joypad key
  42. AFB_FIRE4 = $3        ; green joypad button
  43. AFB_FIRE3 = $4        ; yellow joypad button
  44. AFB_FIRE1 = $5        ; red joypad button
  45. AFB_FIRE2 = $6        ; blue joypad button
  46.  
  47.  
  48. STORE_REGS: MACRO
  49.     movem.l    D0-D7/A0-A6,-(A7)
  50.     ENDM
  51.  
  52. RESTORE_REGS: MACRO
  53.     movem.l    (A7)+,D0-D7/A0-A6
  54.     ENDM
  55.  
  56. WAIT_LMB: MACRO
  57. .wl\@
  58.     btst    #6,$BFE001
  59.     bne    .wl\@
  60.     ENDM
  61.  
  62. WAIT_JOY: MACRO
  63. .wj\@
  64.     btst    #7,$BFE001
  65.     bne    .wj\@
  66.     ENDM
  67.  
  68. GETLVO:MACRO
  69.     move.l    #_LVO\1,D0
  70.     ENDM
  71.  
  72. ; ******* Print/Printf ********
  73. ; Because of buggy Barfly macro argument count,
  74. ; I had to make 2 functions for BARFLY for each Mac_printf and Mac_printh
  75. ;
  76. ; Mac_printf : same as before
  77. ; Mac_print  : no linefeed (same as Mac_printf "string",*anything* , except
  78. ; Barfly does not work properly with it, and as I now use Barfly for JST
  79. ; it's annoying)
  80. ;
  81. ; Mac_printh : same as before
  82. ; Mac_printx : Mac_printh without linefeed
  83.  
  84.     IFD    BARFLY
  85.  
  86. Mac_print: MACRO
  87.  
  88.     move.l    A1,-(A7)
  89.     lea    .text\@(PC),A1
  90.     JSRABS    Display
  91.  
  92.     bra    .ftext\@
  93. .text\@
  94.     dc.b    "\1",0
  95.     even
  96.  
  97. .ftext\@
  98.     move.l    (A7)+,A1
  99.     ENDM
  100.  
  101. Mac_printf: MACRO
  102.     Mac_print    <\1>
  103.     NEWLINE
  104.     ENDM
  105.  
  106. Mac_printh: MACRO
  107.     Mac_printx    \1
  108.     NEWLINE
  109.     ENDM
  110.  
  111. Mac_printx:MACRO
  112.     movem.l    D0/A1,-(A7)
  113.     move.l    \1,D0
  114.     lea    .text\@(PC),A1
  115.     JSRABS    HexToString
  116.     JSRABS    Display
  117.     bra    .ftext\@
  118.  
  119. .text\@
  120.     dc.b    "$00000000",0
  121.     even
  122. .ftext\@
  123.     movem.l    (A7)+,D0/A1
  124.     ENDM
  125.  
  126.     ELSE
  127.  
  128. ; *** macro definitions for other assemblers than Barfly
  129.  
  130. ; ******* Macro Printf ********
  131. ; Mac_printf "text"   -> text + linefeed
  132. ; Mac_printf "text",*any argument* -> text without linefeed
  133.  
  134. Mac_printf: MACRO
  135.  
  136.     move.l    A1,-(A7)
  137.     lea    .text\@(PC),A1
  138.     JSRABS    Display
  139.     bra    .ftext\@
  140. .text\@
  141.     IFD    MAXON_ASM
  142.         dc.b    "\1"
  143.     ELSE
  144.         IFD    BARFLY
  145. ;;            dc.b    "\1"
  146.         ELSE
  147.             DC.B    \1
  148.         ENDIF
  149.     ENDIF
  150.     
  151.     IFLE    NARG-1
  152.     dc.b    10,13
  153.     ENDC
  154.     dc.b    0
  155.     even
  156.  
  157. .ftext\@
  158.     move.l    (A7)+,A1
  159.     ENDM
  160.  
  161. Mac_print:MACRO
  162.     Mac_printf    \1,v
  163.     ENDM
  164.  
  165. ; ******* Macro Printh ********
  166. ; Mac_printh <expr>   -> hex number + linefeed
  167. ; Mac_printh <expr>,*any argument* -> without linefeed
  168.  
  169. Mac_printh: MACRO
  170.  
  171.     movem.l    D0/A1,-(A7)
  172.     move.l    \1,D0
  173.     lea    .text\@(PC),A1
  174.     JSRABS    HexToString
  175.     JSRABS    Display
  176.     bra    .ftext\@
  177.  
  178. .text\@
  179.     dc.b    "$00000000"
  180.     IFLE    NARG-1
  181.     dc.b    10,13
  182.     ENDC
  183.     dc.b    0
  184.     even
  185. .ftext\@
  186.     movem.l    (A7)+,D0/A1
  187.     ENDM
  188.  
  189.     ENDC
  190.  
  191. PUTS: MACRO
  192.     move.l    A1,-(A7)
  193.     lea    \1,A1
  194.     JSRABS    Display
  195.     move.l    (A7)+,A1
  196.     ENDM
  197.  
  198. NEWLINE: MACRO
  199.     JSRABS    NewLine
  200.     ENDM
  201.  
  202.  
  203.  
  204. STOP_SOUND:MACRO
  205.     move.w    #$000F,dmacon+$DFF000
  206.     move.w    #$0000,aud0+ac_len+$DFF000
  207.     move.w    #$0000,aud1+ac_len+$DFF000
  208.     move.w    #$0000,aud2+ac_len+$DFF000
  209.     move.w    #$0000,aud3+ac_len+$DFF000
  210.     ENDM
  211.  
  212. MAKE_ABS_REFS:MACRO
  213.  
  214.     ; *** Non-relocated routines. call normally with JSR
  215.     ; *** don't call them with JSRGEN, this would not compile (better than crash)
  216.  
  217.     DEF_\1_ABS    CloseAll,0        ; quit program (while the OS is up)
  218.     DEF_\1_ABS    CloseAllQuiet,1        ; quit program and close window
  219.     DEF_\1_ABS    LoadDisks,2        ; load diskfiles
  220.     DEF_\1_ABS    LoadDiskFromName,3    ; load a disk
  221.     DEF_\1_ABS    LoadDisksIndex,4    ; load a disk, starting from number D0
  222.     DEF_\1_ABS    LoadFiles,5        ; load files in the directory
  223.     DEF_\1_ABS    LoadSmallFiles,6    ; load small files (<D0)
  224.     DEF_\1_ABS    Kick37Test,7        ; check if Kickstart version <37
  225.     DEF_\1_ABS    KickVerTest,8        ; check against a given kick version
  226.     DEF_\1_ABS    GetMemFlag,9        ; returns MEMF_REVERSE flag isf available
  227.     DEF_\1_ABS    FlushCachesSys,10    ; flush caches using CacheClearU()
  228.     DEF_\1_ABS    Enhance,11        ; restores everything (caches, display)
  229.     DEF_\1_ABS    Degrade,12        ; degrades everything
  230.     DEF_\1_ABS    DegradeCpu,13        ; degrades only CPU related stuff
  231.     DEF_\1_ABS    DegradeGfx,14        ; degrades only GFX related stuff
  232.     DEF_\1_ABS    TransfRoutines,15    ; *** obsolete ***
  233.     DEF_\1_ABS    SaveOSData,16        ; saves OS data (mem,CIAs,custom...)
  234.     DEF_\1_ABS    TestFile,17        ; check if a file is here (game path)
  235.     DEF_\1_ABS    Display,18        ; display a string pointed by A1
  236.     DEF_\1_ABS    LoadRNCFile,19        ; load a RNC file and unpack it
  237.     DEF_\1_ABS    AllocExtMem,20        ; allocate extension memory
  238.     DEF_\1_ABS    Test1MBChip,21        ; check against 1MB of chip (at least)
  239.     DEF_\1_ABS    Test2MBChip,22        ; check against 2MB of chip
  240.     DEF_\1_ABS    Reboot,23        ; reboots :-), only works when OS is alive!
  241.     DEF_\1_ABS    WaitReturn,24        ; waits for the user to press return key
  242.     DEF_\1_ABS    BlockFastMem,25        ; * allocates all fastmem. Do not use :-)
  243.     DEF_\1_ABS    CheckFastMem,26        ; checks if the computer has got fast memory
  244.     DEF_\1_ABS    SupervisorMode,27    ; goes into supervisor mode
  245.     DEF_\1_ABS    UserMode,28        ; goes into user mode
  246.     DEF_\1_ABS    Alloc24BitMem,29    ; allocate extension memory, 24 bit area only
  247.     DEF_\1_ABS    OpenFakeExec,30        ; allocate table for fake exec
  248.     DEF_\1_ABS    SetFilesPath,31        ; change default file path
  249.     DEF_\1_ABS    TestDirectory,32    ; test directory presence (game path)
  250.     DEF_\1_ABS    TestDirectoryAbs,33    ; test directory presence (absolute path)
  251.     DEF_\1_ABS    TestFileAbs,34        ; test file presence (absolute path)
  252.     DEF_\1_ABS    SetLocalVarZone,35    ; save start-end of local object variables
  253.     DEF_\1_ABS    InitLogPatch,36        ; initialize patch logging (private function)
  254.     DEF_\1_ABS    TestAssign,37        ; test assign presence
  255.     DEF_\1_ABS    AllocateTheMemory,38    ; AllocMem with ressource-tracking
  256.     DEF_\1_ABS    FreeTheMemory,39    ; AllocMem with ressource-tracking
  257.     DEF_\1_ABS    HexToString,40        ; HexToString, absolute call
  258.     DEF_\1_ABS    UseHarryOSEmu,41    ; Tell JST to use Harry's great OS emu
  259.     DEF_\1_ABS    NewLine,42        ; Prints a newline
  260.     DEF_\1_ABS    DisableChipmemGap,43    ; Will allow LOWMEM with 2MB chip
  261.     DEF_\1_ABS    GetFileLength,44    ; Returns the length of a file on disk
  262.     DEF_\1_ABS    CloseAllWithError,45    ; internal - do not use
  263.     DEF_\1_ABS    LogChipMirror,46    ; internal - do not use
  264.     DEF_\1_ABS    LogCustomMirror,47    ; internal - do not use
  265.     DEF_\1_ABS    LogExtMemory,48        ; internal - do not use
  266.     DEF_\1_ABS    LogRegisters,49        ; internal - do not use
  267.     DEF_\1_ABS    DisableMMU,50        ; internal - do not use
  268.     DEF_\1_ABS    SetClockLoad,51        ; internal - do not use
  269.     DEF_\1_ABS    Unsupported2,52        ; future use
  270.     DEF_\1_ABS    Unsupported3,53        ; future use
  271.     DEF_\1_ABS    Unsupported4,54        ; future use
  272.     DEF_\1_ABS    Unsupported5,55        ; future use
  273.     DEF_\1_ABS    Unsupported6,56        ; future use
  274.     DEF_\1_ABS    Unsupported7,57        ; future use
  275.     DEF_\1_ABS    Unsupported8,58        ; future use
  276.  
  277.     ENDM
  278.     
  279.     ; *** Relocated routines. always call with JSRGEN (see macros.i)
  280.     ; *** from user program. It works with JSR but if the OS is killed
  281.     ; *** JSRGEN is safer as it jumps in the allocated block
  282.     ; *** which is in the top of memory (MEMF_REVERSE) if kick > 38
  283.     ; *** fast memory is used when found, else chipmem is used
  284.     ; ***
  285.     ; *** I also included a short description of the routines
  286.     ; *** Please read the autodocs to get more details
  287.     
  288.     ; *** The functions marked with a * should not be used anymore
  289.  
  290. MAKE_REL_REFS:MACRO
  291.     DEF_\1_REL    GetSR,0            ; returns SR in D0
  292.     DEF_\1_REL    GoECS,1            ; resets sprite aspect/playfield/goes 15KHz (obsolete)
  293.     DEF_\1_REL    GetAttnFlags,2        ; gets system backuped AttnFlags, at any time
  294.     DEF_\1_REL    ResetDisplay,3        ; switches in PAL or NTSC if specified
  295.     DEF_\1_REL    ResetSprites,4        ; resets sprite aspect
  296.     DEF_\1_REL    BlackScreen,5        ; sets all color registers to black
  297.     DEF_\1_REL    JoypadState,6        ; to check the state of joystick/joypad
  298.     DEF_\1_REL    InitTrackDisk,7        ; returns a fake disk IO pointer in A1
  299.     DEF_\1_REL    TrackLoad,8        ; simulates DoIO()
  300.     DEF_\1_REL    TrackLoadFast,9        ; * same routine. Please use the TrackLoad name
  301.     DEF_\1_REL    SetTDUnit,10        ; sets drive unit in D0 (for DoIO emulation)
  302.     DEF_\1_REL    SetDisk,11        ; sets current disk (useful with HDLOAD)
  303.     DEF_\1_REL    ReadRobSectors,12    ; reads sectors, rob northen interface
  304.     DEF_\1_REL    ReadRobSectorsFast,13    ; * same routine. Use ReadRobSectors instead
  305.     DEF_\1_REL    ReadFile,14        ; reads file, rob northen interface, from RAM or HD
  306.     DEF_\1_REL    ReadFileFast,15        ; reads file, rob northen interface, from RAM only
  307.     DEF_\1_REL    ReadFilePartHD,16    ; partially reads file, modified rob northen interface, from HD only
  308.     DEF_\1_REL    ReadDiskPart,17        ; reads parts of a disk, from RAM or HD (LOWMEM decides)
  309.     DEF_\1_REL    ReadFileHD,18        ; reads file, rob northen interface, from HD only
  310.     DEF_\1_REL    WriteFileHD,19        ; writes file on HD during game
  311.     DEF_\1_REL    DeleteFileHD,20        ; deletes file from HD during game (careful :-))
  312.     DEF_\1_REL    PPDecrunch,21        ; decrunches PowerPacker files/blocks
  313.     DEF_\1_REL    ImploderDecrunch,22    ; decrunches Imploder files/blocks
  314.     DEF_\1_REL    ATNDecrunch,23        ; decrunches ATN! files/blocks
  315.     DEF_\1_REL    RNCDecrunch,24        ; decrunches RNC\01,\02 files/blocks
  316.     DEF_\1_REL    FungusDecrunch,25    ; decrunches Gremlins packer files/blocks
  317.     DEF_\1_REL    RNCDecrunchEncrypted,26    ; decrunches RNC/01 encrypted files/blocks
  318.     DEF_\1_REL    RNCLength,27        ; gives the length of decunched RNC file
  319.     DEF_\1_REL    FlushCachesHard,28    ; flushes all caches
  320.     DEF_\1_REL    WaitBlit,29        ; waits till blitter operation is complete
  321.     DEF_\1_REL    BeamDelay,30        ; waits using $DFF006 register (beam)
  322.     DEF_\1_REL    InGameOSCall,31        ; calls a user OS routine during the game
  323.     DEF_\1_REL    PatchExceptions,32    ; re-install JOTD exception handler (only exceptions)
  324.     DEF_\1_REL    StrcmpAsm,33        ; compares 2 strings (null termintated). Not case sensitive
  325.     DEF_\1_REL    StrcpyAsm,34        ; copies a string (null terminated)
  326.     DEF_\1_REL    StrlenAsm,35        ; returns length of a string (ends with null)
  327.     DEF_\1_REL    ToUpperAsm,36        ; converts a string in upper case
  328.     DEF_\1_REL    WaitMouse,37        ; waits for LMB to be pressed. Colors fill the screen
  329.     DEF_\1_REL    WaitMouseInterrupt,38    ; same thing but interrupts are enabled (HRTMon)
  330.     DEF_\1_REL    GetDiskPointer,39    ; gets start of the specified diskfile (D0) (can be avoided)
  331.     DEF_\1_REL    CheckAGA,40        ; checks if the computer is AGA using DeniseId
  332.     DEF_\1_REL    SetExitRoutine,41    ; to call a user routine just before exit
  333.     DEF_\1_REL    InGameExit,42        ; exits to WB from game at any time
  334.     DEF_\1_REL    SaveCustomRegs,43    ; saves important custom registers
  335.     DEF_\1_REL    RestoreCustomRegs,44    ; restores them
  336.     DEF_\1_REL    SaveCIARegs,45        ; saves all CIA info possible and LED state
  337.     DEF_\1_REL    RestoreCIARegs,46    ; restores them
  338.     DEF_\1_REL    FreezeAll,47        ; clears all ints, dma...
  339.     DEF_\1_REL    ReadUserFileHD,48    ; reads file, from HD in user SAVEDIR directory
  340.     DEF_\1_REL    WriteUserFileHD,49    ; writes file on HD in user SAVEDIR directory
  341.     DEF_\1_REL    DeleteUserFileHD,50    ; removes file from HD in user SAVEDIR directory
  342.     DEF_\1_REL    TPWMDecrunch,51        ; decrunches TPWM files/blocks (experimental)
  343.     DEF_\1_REL    WaitBOF,52        ; waits bottom of frame, hardware coded (experimental)
  344.     DEF_\1_REL    ReadUserDir,53        ; reads user directory in a robdir structure
  345.     DEF_\1_REL    PatchZeroPage,54    ; install JOTD exception handler (done in SaveOSData)
  346.     DEF_\1_REL    FireDecrunch,55        ; decrunch FIRE packer files/blocks
  347.     DEF_\1_REL    HexReplaceLong,56    ; search/replace a longword in a zone
  348.     DEF_\1_REL    HexReplaceWord,57    ; search/replace a word in a zone
  349.     DEF_\1_REL    UnsupportedC,58        ; fake exec SetFunction() *removed*
  350.     DEF_\1_REL    GetUserData,59        ; returns userdata string
  351.     DEF_\1_REL    StrncpyAsm,60        ; strncpy, D2 limits string length
  352.     DEF_\1_REL    PatchMoveCList_Idx,61    ; patches move.l #adr,($80,Ax) 
  353.     DEF_\1_REL    StoreCopperPointer,62    ; stores manually copper address
  354.     DEF_\1_REL    TellCopperPointer,63    ; returns previously stored copper address
  355.     DEF_\1_REL    InGameIconify,64    ; iconifies the game
  356.     DEF_\1_REL    PatchMoveCList_Abs,65    ; patches move.l #adr,($DFF080) 
  357.     DEF_\1_REL    PatchMoveCList_Ind,66    ; patches move.l adr,($DFF080) 
  358.     DEF_\1_REL    LogPatch,67        ; store before-patch information
  359.     DEF_\1_REL    PatchMoveBlit_Idx,68    ; patches move.w #blit,($58,Ax)
  360.     DEF_\1_REL    HexToString,69        ; hex to string conversion
  361.     DEF_\1_REL    IsRegistered,70        ; check to see if JST is registered
  362.     DEF_\1_REL    SetQuitKey,71        ; set the key for auto quit
  363.     DEF_\1_REL    SetIconifyKey,72    ; set the key for auto iconify
  364.     DEF_\1_REL    ReadFilePart,73        ; partially reads file, modified rob northen interface
  365.     DEF_\1_REL    StrncmpAsm,74        ; partially compares 2 strings UC=LC
  366.     DEF_\1_REL    CRC16,75        ; calculates CRC16 for a block
  367.     DEF_\1_REL    TSMDecrunch,76        ; decrunches a TSM! file
  368.     DEF_\1_REL    EnterDebugger,77    ; enter your Debugger/Freezer if any present
  369.     DEF_\1_REL    ReadFileFromImage,78    ; Load a file from a "DOS\0" image
  370.     DEF_\1_REL    EnableMMU,79        ; Enable the MMU translation
  371.     DEF_\1_REL    DisableMMU,80        ; Disable the MMU translation
  372.     DEF_\1_REL    SetTraceVector,81    ; Modifies trace vector ($24.W+VBR)
  373.     DEF_\1_REL    GetUserFlags,82        ; Gets some of the user tooltypes
  374.     DEF_\1_REL    InstallHarryOSEmu,83    ; private, do not use
  375.     DEF_\1_REL    AddPart,84        ; concatenates dirname[/:]filename
  376.     DEF_\1_REL    CopyMem,85        ; copies memory
  377. ;;    DEF_\1_REL    Relocate,86        ; relocates executable
  378.     DEF_\1_REL    Unsupported9,86        ; future use
  379.     DEF_\1_REL    Unsupported5,87        ; future use
  380.     DEF_\1_REL    Unsupported6,88        ; future use
  381.     DEF_\1_REL    Unsupported7,89        ; future use
  382.     DEF_\1_REL    Unsupported1,90        ; future use
  383.     DEF_\1_REL    Unsupported2,91        ; future use
  384.     DEF_\1_REL    Unsupported3,92        ; future use
  385.     DEF_\1_REL    Unsupported4,93        ; future use
  386.     
  387.     ENDM
  388.  
  389. DEF_OFFSET_ABS:MACRO
  390. AbsOff_\1 = \2*4
  391.     ENDM
  392.  
  393. DEF_OFFSET_REL:MACRO
  394. RelOff_\1 = \2*4
  395.     ENDM
  396.  
  397. DEF_ADDR_ABS:MACRO
  398. AbsAdd_\1:
  399.     dc.l    AbsFun_\1
  400.     ENDM
  401.  
  402. DEF_ADDR_REL:MACRO
  403.     XDEF    RelFun_\1
  404. RelAdd_\1:
  405.     dc.l    RelFun_\1
  406.     ENDM
  407.  
  408.  
  409. RELOC_CLRL:MACRO
  410.     IFNE    NARG-1
  411.         FAIL    arguments "RELOC_CLRL"
  412.     ENDC
  413.  
  414.     RELOC_MOVEL    #0,\1
  415.     ENDM
  416.  
  417. RELOC_CLRW:MACRO
  418.     IFNE    NARG-1
  419.         FAIL    arguments "RELOC_CLRW"
  420.     ENDC
  421.  
  422.     RELOC_MOVEW    #0,\1
  423.     ENDM
  424.  
  425. RELOC_CLRB:MACRO
  426.     IFNE    NARG-1
  427.         FAIL    arguments "RELOC_CLRB"
  428.     ENDC
  429.  
  430.     RELOC_MOVEB    #0,\1
  431.     ENDM
  432.  
  433. RELOC_STL:MACRO
  434.     IFNE    NARG-1
  435.         FAIL    arguments "RELOC_STL"
  436.     ENDC
  437.  
  438.     RELOC_MOVEL    #-1,\1
  439.     ENDM
  440.  
  441. RELOC_STW:MACRO
  442.     IFNE    NARG-1
  443.         FAIL    arguments "RELOC_STW"
  444.     ENDC
  445.  
  446.     RELOC_MOVEW    #-1,\1
  447.     ENDM
  448.  
  449. RELOC_STB:MACRO
  450.     IFNE    NARG-1
  451.         FAIL    arguments "RELOC_STB"
  452.     ENDC
  453.  
  454.     RELOC_MOVEB    #-1,\1
  455.     ENDM
  456.  
  457. RELOC_MOVEL:MACRO
  458.     IFNE    NARG-2
  459.         FAIL    arguments "RELOC_MOVEL"
  460.     ENDC
  461.  
  462.     movem.l    D0/A6,-(sp)
  463.     lea    \2(pc),A6
  464.     move.l    \1,(A6)
  465.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  466.     ENDM
  467.  
  468. RELOC_MOVEW:MACRO
  469.     IFNE    NARG-2
  470.         FAIL    arguments "RELOC_MOVEW"
  471.     ENDC
  472.  
  473.     movem.l    A6/D0,-(sp)
  474.     lea    \2(pc),A6
  475.     move.w    \1,(A6)
  476.     movem.l    (sp)+,D0/A6
  477.     ENDM
  478.  
  479. RELOC_MOVEB:MACRO
  480.     IFNE    NARG-2
  481.         FAIL    arguments "RELOC_MOVEB"
  482.     ENDC
  483.  
  484.     movem.l    A6/D0,-(sp)
  485.     lea    \2(pc),A6
  486.     move.b    \1,(A6)
  487.     movem.l    (sp)+,D0/A6
  488.     ENDM
  489.  
  490. RELOC_ADDL:MACRO
  491.     IFNE    NARG-2
  492.         FAIL    arguments "RELOC_ADDL"
  493.     ENDC
  494.  
  495.     movem.l    D0/A6,-(sp)
  496.     lea    \2(pc),A6
  497.     add.l    \1,(A6)
  498.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  499.     ENDM
  500.  
  501. RELOC_ADDW:MACRO
  502.     IFNE    NARG-2
  503.         FAIL    arguments "RELOC_ADDW"
  504.     ENDC
  505.  
  506.     movem.l    A6/D0,-(sp)
  507.     lea    \2(pc),A6
  508.     add.w    \1,(A6)
  509.     movem.l    (sp)+,D0/A6
  510.     ENDM
  511.  
  512. RELOC_ADDB:MACRO
  513.     IFNE    NARG-2
  514.         FAIL    arguments "RELOC_ADDB"
  515.     ENDC
  516.  
  517.     movem.l    A6/D0,-(sp)
  518.     lea    \2(pc),A6
  519.     add.b    \1,(A6)
  520.     movem.l    (sp)+,D0/A6
  521.     ENDM
  522.  
  523.  
  524. RELOC_SUBL:MACRO
  525.     IFNE    NARG-2
  526.         FAIL    arguments "RELOC_SUBL"
  527.     ENDC
  528.  
  529.     movem.l    D0/A6,-(sp)
  530.     lea    \2(pc),A6
  531.     sub.l    \1,(A6)
  532.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  533.     ENDM
  534.  
  535. RELOC_SUBW:MACRO
  536.     IFNE    NARG-2
  537.         FAIL    arguments "RELOC_SUBW"
  538.     ENDC
  539.  
  540.     movem.l    A6/D0,-(sp)
  541.     lea    \2(pc),A6
  542.     sub.w    \1,(A6)
  543.     movem.l    (sp)+,D0/A6
  544.     ENDM
  545.  
  546. RELOC_SUBB:MACRO
  547.     IFNE    NARG-2
  548.         FAIL    arguments "RELOC_SUBB"
  549.     ENDC
  550.  
  551.     movem.l    A6/D0,-(sp)
  552.     lea    \2(pc),A6
  553.     sub.b    \1,(A6)
  554.     movem.l    (sp)+,D0/A6
  555.     ENDM
  556.  
  557. RELOC_TSTL:MACRO
  558.     IFNE    NARG-1
  559.         FAIL    arguments "RELOC_TSTL"
  560.     ENDC
  561.  
  562.     movem.l    D0/A0,-(sp)
  563.     lea    \1(pc),A0
  564.     tst.l    (A0)
  565.     movem.l    (sp)+,D0/A0
  566.     ENDM
  567.  
  568. RELOC_TSTW:MACRO
  569.     IFNE    NARG-1
  570.         FAIL    arguments "RELOC_TSTW"
  571.     ENDC
  572.  
  573.     movem.l    D0/A0,-(sp)
  574.     lea    \1(pc),A0
  575.     tst.w    (A0)
  576.     movem.l    (sp)+,D0/A0
  577.     ENDM
  578.  
  579. RELOC_TSTB:MACRO
  580.     IFNE    NARG-1
  581.         FAIL    arguments "RELOC_TSTB"
  582.     ENDC
  583.  
  584.     movem.l    D0/A0,-(sp)
  585.     lea    \1(pc),A0
  586.     tst.b    (A0)
  587.     movem.l    (sp)+,D0/A0
  588.     ENDM
  589.  
  590.     ; *** builds the function offsets
  591.  
  592.     MAKE_ABS_REFS    OFFSET
  593.     MAKE_REL_REFS    OFFSET
  594.  
  595. HDP_SAFETY = $00
  596. HDP_MAGIC = $04
  597. HDP_VERSION = $08
  598. HDP_ABSTABLE = $0C
  599. HDP_RELTABLE = $10
  600. HDP_FILESIZE = $14
  601. HDP_NBDISKS = $18
  602. HDP_ENTRY = $1C
  603. HDP_FNAME = $20
  604. HDP_SYSBASE = $24
  605. HDP_DOSBASE = $28
  606.     ENDC
  607.